package com.fansl.allround.common.core.config;

import lombok.Data;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;

/**
 * @author fansl
 * @Description: TODO
 * @date 2019/9/10 16:23
 */
@Data
@Configuration
@RefreshScope
@ConditionalOnExpression("!'${redis.cache}'.isEmpty()")
@ConfigurationProperties(prefix = "redis.cache")
public class RedisCacheProperties {
    private List<Config> configs = new ArrayList<>();

    @Data
    public static class Config{
        private String cacheName;
        private int expireInSecond;
    }
    @PostConstruct
    public void init(){
        System.out.println(".................. RedisCacheProperties init .................");
    }
}
